<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <h1>jquery的ajax请求</h1>
    <button id="btn">发起请求</button>
</body>

</html>
<script src="https://cdn.bootcdn.net/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
<script>


    btn.onclick = function () {

        // $.post(请求地址 [,参数] ,callback)

        // $.post("http://localhost:3000/students",(results)=>{
        //     console.log(results);
        // })


        // 查询字符串传参
        // $.post("http://localhost:3000/students","username=zs&password=123",(results)=>{
        //     console.log(results);
        // })


        // 对象的形式传参
        $.post("http://localhost:3000/students",{username:"ls",password:"aaa"},(results)=>{
            console.log(results);
        })

    }



</script>